package cn.neusoft.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@NoArgsConstructor
@Data
@ToString
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Order {
	private Integer orderId;
	private String orderNumber;//订单编号，在前端的时候，会自动生成一个账户
	private Integer userId;
	private Integer businessId;
	//改成这样的形式这说明数据库那边类型是date没问题，在命令行中进行插入数据的时候，写成详细日期字符串的时候会出现问题
	@JsonFormat(pattern = "yyyy-MM-dd-HH-mm-ss",timezone = "GMT+8")
	private Date orderDate;

	private Double orderTotal;//订单总价
	private Integer addressId;//送货地址编号的

	private Integer orderState;//订单状态

	public Order(Integer orderId, String orderNumber, Integer userId, Integer businessId, Date orderDate, Double orderTotal, Integer addressId, Integer orderState) {
		this.orderId = orderId;
		this.orderNumber = orderNumber;
		this.userId = userId;
		this.businessId = businessId;
		this.orderDate = orderDate;
		this.orderTotal = orderTotal;
		this.addressId = addressId;
		this.orderState = orderState;
	}

	private User user;
	private Business business;
	private Address address;
	private List<OrderDetail>  detailList=new ArrayList<>();
}
